<template>
  <!-- <h2>盘点管理</h2> -->
  <zsearch v-loading="loading">
      <template #title>
        <span>盘点管理</span>
      </template>
      <template #date>
        <el-date-picker
            class="date-1"
            type="datetime"
            value-format="YYYY-MM-DD HH:mm:ss"
            v-model="date"
            placeholder="选择日期"
            >
        </el-date-picker>
      </template>
      <template #select>
        <el-input class="input-1" v-model="name" placeholder="请输入内容"></el-input>
      </template>
      <template #btns>
        <el-button class="btn-1" v-jurisdiction="'warehouse:checkOrder:list'" >查询</el-button>
			  <el-button class="btn-2">导出</el-button>
      </template>
      <template #table>
        <ztable 
          :tableData='data' 
          :strucs='groupData'
          :btnData="btnData"
          :header-cell-style="{background:'#11b9d0', color:'#fff'}"
          :height="'100%'"
        >
        
        </ztable>
      </template>
      <template #page>
        <zpage
            :currentPage="current" 
            :total="total" 
            :pageSize="size"
            @handleSizeChange="handleSizeChange" 
            @handleCurrentChange="handleCurrentChange"
        ></zpage>
      </template>
    </zsearch>
</template>

<script lang='ts'>
import { defineComponent, reactive, toRefs, ref } from '@vue/runtime-core'
import ztable from '@components/Table/index.vue'
import zpage from '@components/pagination/pagination.vue'
import zsearch from '@components/search/search.vue'
import zdialog from '@components/dialog/dialog.vue'

import useConfgin from '../../hook/getconfig'
import useRequet, { RespData } from "../../hook/network"
import { ElMessage } from 'element-plus'

const configID = 544; // 盘点表格结构
export default defineComponent({
  name: 'Inventory',
  components: {
    ztable,
    zpage,
    zsearch,
    zdialog
  },

  setup() {
    const rowList = useConfgin(configID)
    console.log('盘点列表',rowList)
    const groupData = rowList.groupDataList.value;
    const request = useRequet({ path: "" });
    let search = reactive({
      name:'',
      date: '',
      loading: false,

      current: 1,
      size: 10,
      total: 0
    })
    const data = ref([])
     // 分页
    const handleCurrentChange = (val: number) => {
			search.current = val
      req()
			console.log('handleCurrentChange', val)
		}
    const handleSizeChange = (val: number) => {
      search.size = val
      req()
			console.log('handleSizeChange', val)
		}
    const req = () => {
      // search.loading = true
      // request.sendRequest({
      //   address: 'warehouse/count/getGoodCountPage',
      //   params: search || {},
      //   success: (resp: RespData) => {
      //     if(resp.code !== 0) return ElMessage.error(resp.msg || '获取仓库数据失败')
			// 		data.value = resp.data.records
      //     search.total = resp.data.total
      //     search.current = resp.data.current
      //     console.log(data)

      //     search.loading = false
      //   },
      //   fail: (resp: RespData) => {
      //     if(resp.code !== 0) return ElMessage.error(resp.msg || '获取仓库数据失败')
          
      //   },
      //   method: "POST",
      // })
    }
    req()

    const btnData = [
      {
        
      }
    ]

    return {
      request,
      ...toRefs(search),
      data,
      groupData,
      btnData,

      handleCurrentChange,
      handleSizeChange,

    }
  }
})
</script>

<style>

</style>